#  冒泡排序
import random
from utils.array_utils import check


def bubbles(nums):
    size = len(nums)
    i = 0
    for j in range(size - i, -1, -1):
        for i in range(size):
            # print(f'j: {j}, i: {i}')
            if i + 1 < j and nums[i] > nums[i + 1]:
                # print(f'nums[{i}],nums[{i+1}]: {nums[i]},{nums[i+1]}')
                nums[i], nums[i + 1] = nums[i + 1], nums[i]
                print(nums)
            else:
                i += 1


if __name__ == '__main__':
    l = []
    size = range(random.randint(5, 15))
    for i in range(6):
        l.append(random.randint(0, 100))
    print(l)
    bubbles(l)
    print(l)
    print(check(l))

